/*
 Navicat Premium Data Transfer

 Source Server         : docker-mysql
 Source Server Type    : MySQL
 Source Server Version : 80020
 Source Host           : localhost:3306
 Source Schema         : db_micro

 Target Server Type    : MySQL
 Target Server Version : 80020
 File Encoding         : 65001

 Date: 29/06/2020 17:54:10
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for sys_permission
-- ----------------------------
DROP TABLE IF EXISTS `sys_permission`;
CREATE TABLE `sys_permission` (
  `id` varchar(40) NOT NULL COMMENT '主键id',
  `description` varchar(100) DEFAULT NULL COMMENT '权限描述',
  `name` varchar(50) DEFAULT NULL COMMENT '权限名称',
  `type` tinyint(1) NOT NULL COMMENT '权限类型 1为菜单 2为功能 3为API',
  `pid` varchar(40) DEFAULT '0' COMMENT '上级Id',
  `code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '权限编码',
  `version` int NOT NULL COMMENT '版本锁标识',
  `create_name` varchar(40) NOT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `UK_type_code` (`type`,`code`),
  KEY `FK_code` (`type`),
  KEY `FK_type` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='权限管理表';

-- ----------------------------
-- Records of sys_permission
-- ----------------------------
BEGIN;
INSERT INTO `sys_permission` VALUES ('1275298471313702912', '首页', '首页', 1, '0', 'MENU_HOME', 1, 'admin', '2020-06-23 13:23:44', '2020-06-23 13:31:12');
INSERT INTO `sys_permission` VALUES ('1275298697055338496', '系统管理', '系统管理', 1, '0', 'MENU_SYS', 0, 'admin', '2020-06-23 13:24:38', '2020-06-23 13:24:38');
INSERT INTO `sys_permission` VALUES ('1275299250242093056', '权限管理', '权限管理', 1, '1275298697055338496', 'MENU_PERMISSION', 0, 'admin', '2020-06-23 13:26:50', '2020-06-23 05:55:13');
INSERT INTO `sys_permission` VALUES ('1275299466001285120', '角色管理', '角色管理', 1, '1275298697055338496', 'MENU_ROLE', 0, 'admin', '2020-06-23 13:27:41', '2020-06-23 05:55:13');
INSERT INTO `sys_permission` VALUES ('1275299599447261184', '用户管理', '用户管理', 1, '1275298697055338496', 'MENU_USER', 0, 'admin', '2020-06-23 13:28:13', '2020-06-23 05:55:13');
INSERT INTO `sys_permission` VALUES ('1275337443121360896', '用户新增按钮', '用户新增按钮', 2, '1275299599447261184', 'B_USER_SAVE', 0, 'admin', '2020-06-23 15:58:36', '2020-06-23 15:58:36');
INSERT INTO `sys_permission` VALUES ('1275346858469826560', '用户删除按钮', '用户删除按钮', 2, '1275299599447261184', 'B_USER_DEL', 0, 'admin', '2020-06-23 16:36:01', '2020-06-23 16:36:01');
INSERT INTO `sys_permission` VALUES ('1275346962291433472', '用户更新按钮', '用户更新按钮', 2, '1275299599447261184', 'B_USER_UPDATE', 0, 'admin', '2020-06-23 16:36:25', '2020-06-23 16:36:25');
INSERT INTO `sys_permission` VALUES ('1275347518758133760', '角色更新按钮', '角色更新按钮', 2, '1275299466001285120', 'B_ROLE_UPDATE', 0, 'admin', '2020-06-23 16:38:38', '2020-06-23 08:39:50');
INSERT INTO `sys_permission` VALUES ('1275347585481121792', '角色删除按钮', '角色删除按钮', 2, '1275299466001285120', 'B_ROLE_DEL', 0, 'admin', '2020-06-23 16:38:54', '2020-06-23 08:39:50');
INSERT INTO `sys_permission` VALUES ('1275347652111835136', '角色新增按钮', '角色新增按钮', 2, '1275299466001285120', 'B_ROLE_SAVE', 0, 'admin', '2020-06-23 16:39:10', '2020-06-23 08:39:50');
INSERT INTO `sys_permission` VALUES ('1275347935546122240', '权限新增按钮', '权限新增按钮', 2, '1275299250242093056', 'B_PERMISSION_SAVE', 0, 'admin', '2020-06-23 16:40:17', '2020-06-23 16:40:17');
INSERT INTO `sys_permission` VALUES ('1275347999077244928', '权限删除按钮', '权限删除按钮', 2, '1275299250242093056', 'B_PERMISSION_DEL', 0, 'admin', '2020-06-23 16:40:32', '2020-06-23 16:40:32');
INSERT INTO `sys_permission` VALUES ('1275348056220442624', '权限更新按钮', '权限更新按钮', 2, '1275299250242093056', 'B_PERMISSION_UPDATE', 0, 'admin', '2020-06-23 16:40:46', '2020-06-23 16:40:46');
INSERT INTO `sys_permission` VALUES ('1275663262871998464', '接口权限新增', '接口权限新增', 3, '1275299250242093056', 'API_PERMISSION_SAVE', 0, 'admin', '2020-06-24 13:33:17', '2020-06-24 13:33:17');
INSERT INTO `sys_permission` VALUES ('1275664156741095424', '接口权限删除', '接口权限删除', 3, '1275299250242093056', 'API_PERMISSION_DEL', 0, 'admin', '2020-06-24 13:36:50', '2020-06-24 13:36:50');
INSERT INTO `sys_permission` VALUES ('1275664533494452224', '接口权限查询', '接口权限查询', 3, '1275299250242093056', 'API_PERMISSION_FIND', 0, 'admin', '2020-06-24 13:38:20', '2020-06-24 13:38:20');
INSERT INTO `sys_permission` VALUES ('1275665031249285120', '接口权限查询', '接口权限更新', 3, '1275299250242093056', 'API_PERMISSION_UPDATE', 0, 'admin', '2020-06-24 13:40:19', '2020-06-24 13:40:19');
INSERT INTO `sys_permission` VALUES ('1275665454454558720', '接口角色新增', '接口角色新增', 3, '1275299466001285120', 'API_ROLE_SAVE', 0, 'admin', '2020-06-24 13:42:00', '2020-06-24 13:42:00');
INSERT INTO `sys_permission` VALUES ('1275665518673547264', '接口角色更新', '接口角色更新', 3, '1275299466001285120', 'API_ROLE_UPDATE', 0, 'admin', '2020-06-24 13:42:15', '2020-06-24 13:42:15');
INSERT INTO `sys_permission` VALUES ('1275665596758904832', '接口角色删除', '接口角色删除', 3, '1275299466001285120', 'API_ROLE_DELETE', 0, 'admin', '2020-06-24 13:42:34', '2020-06-24 13:42:34');
INSERT INTO `sys_permission` VALUES ('1275665652522176512', '接口角色查询', '接口角色查询', 3, '1275299466001285120', 'API_ROLE_FIND', 0, 'admin', '2020-06-24 13:42:47', '2020-06-24 13:42:47');
INSERT INTO `sys_permission` VALUES ('1275665787255803904', '接口用户新增', '接口用户新增', 3, '1275299599447261184', 'API_USER_SAVE', 0, 'admin', '2020-06-24 13:43:19', '2020-06-24 13:43:19');
INSERT INTO `sys_permission` VALUES ('1275665848387784704', '接口用户更新', '接口用户更新', 3, '1275299599447261184', 'API_USER_UPDATE', 0, 'admin', '2020-06-24 13:43:34', '2020-06-24 13:43:34');
INSERT INTO `sys_permission` VALUES ('1275665901982601216', '接口用户删除', '接口用户删除', 3, '1275299599447261184', 'API_USER_DEL', 0, 'admin', '2020-06-24 13:43:46', '2020-06-24 13:43:46');
INSERT INTO `sys_permission` VALUES ('1275665967027867648', '接口用户查询', '接口用户查询', 3, '1275299599447261184', 'API_USER_FIND', 0, 'admin', '2020-06-24 13:44:02', '2020-06-24 13:44:02');
INSERT INTO `sys_permission` VALUES ('1275675736404971520', '接口分配权限', '接口分配权限', 3, '1275299250242093056', 'API_PERMISSION_ASSIGN', 0, 'admin', '2020-06-24 14:22:51', '2020-06-28 10:12:25');
INSERT INTO `sys_permission` VALUES ('1277185714806616064', '按钮分配权限', '按钮分配权限', 2, '1275299250242093056', 'B_PERMISSION_ASSIGN', 0, 'admin', '2020-06-28 18:22:58', '2020-06-28 18:22:58');
COMMIT;

-- ----------------------------
-- Table structure for sys_permission_api
-- ----------------------------
DROP TABLE IF EXISTS `sys_permission_api`;
CREATE TABLE `sys_permission_api` (
  `id` varchar(40) NOT NULL COMMENT '主键ID',
  `api_level` tinyint DEFAULT '2' COMMENT '权限等级，1为通用接口权限，2为需校验接口权限',
  `api_method` varchar(8) DEFAULT 'post' COMMENT '请求类型',
  `api_url` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '链接',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='权限接口表';

-- ----------------------------
-- Records of sys_permission_api
-- ----------------------------
BEGIN;
INSERT INTO `sys_permission_api` VALUES ('1275663262871998464', 2, '', '');
INSERT INTO `sys_permission_api` VALUES ('1275664156741095424', 2, '', '');
INSERT INTO `sys_permission_api` VALUES ('1275664533494452224', 2, '', '');
INSERT INTO `sys_permission_api` VALUES ('1275665031249285120', 2, '', '');
INSERT INTO `sys_permission_api` VALUES ('1275665454454558720', 2, '', '');
INSERT INTO `sys_permission_api` VALUES ('1275665518673547264', 2, '', '');
INSERT INTO `sys_permission_api` VALUES ('1275665596758904832', 2, '', '');
INSERT INTO `sys_permission_api` VALUES ('1275665652522176512', 2, '', '');
INSERT INTO `sys_permission_api` VALUES ('1275665787255803904', 2, '', '');
INSERT INTO `sys_permission_api` VALUES ('1275665848387784704', 2, '', '');
INSERT INTO `sys_permission_api` VALUES ('1275665901982601216', 2, '', '');
INSERT INTO `sys_permission_api` VALUES ('1275665967027867648', 2, '', '');
INSERT INTO `sys_permission_api` VALUES ('1275675736404971520', 2, '', '');
COMMIT;

-- ----------------------------
-- Table structure for sys_permission_menu
-- ----------------------------
DROP TABLE IF EXISTS `sys_permission_menu`;
CREATE TABLE `sys_permission_menu` (
  `id` varchar(40) NOT NULL COMMENT '主键ID',
  `menu_url` varchar(100) NOT NULL COMMENT '路由地址',
  `menu_icon` varchar(20) DEFAULT NULL COMMENT '展示图标',
  `menu_order` tinyint DEFAULT NULL COMMENT '排序号',
  PRIMARY KEY (`id`),
  UNIQUE KEY `UK_menu_url` (`menu_url`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='权限菜单表';

-- ----------------------------
-- Records of sys_permission_menu
-- ----------------------------
BEGIN;
INSERT INTO `sys_permission_menu` VALUES ('1275298471313702912', '/home', 'icon-iconfonthome0', 0);
INSERT INTO `sys_permission_menu` VALUES ('1275298697055338496', '/system', 'icon-xitong1', 1);
INSERT INTO `sys_permission_menu` VALUES ('1275299250242093056', 'permission', 'icon-quanxian', 2);
INSERT INTO `sys_permission_menu` VALUES ('1275299466001285120', 'role', 'icon-role', 3);
INSERT INTO `sys_permission_menu` VALUES ('1275299599447261184', 'user', 'icon-yonghu', 4);
COMMIT;

-- ----------------------------
-- Table structure for sys_permission_point
-- ----------------------------
DROP TABLE IF EXISTS `sys_permission_point`;
CREATE TABLE `sys_permission_point` (
  `id` varchar(40) NOT NULL COMMENT '主键ID',
  `point_class` varchar(20) DEFAULT NULL COMMENT '按钮类型',
  `point_icon` varchar(20) DEFAULT NULL COMMENT '按钮icon',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='权限按钮表';

-- ----------------------------
-- Records of sys_permission_point
-- ----------------------------
BEGIN;
INSERT INTO `sys_permission_point` VALUES ('1275337443121360896', '', '');
INSERT INTO `sys_permission_point` VALUES ('1275346858469826560', '', '');
INSERT INTO `sys_permission_point` VALUES ('1275346962291433472', '', '');
INSERT INTO `sys_permission_point` VALUES ('1275347518758133760', '', '');
INSERT INTO `sys_permission_point` VALUES ('1275347585481121792', '', '');
INSERT INTO `sys_permission_point` VALUES ('1275347652111835136', '', '');
INSERT INTO `sys_permission_point` VALUES ('1275347935546122240', '', '');
INSERT INTO `sys_permission_point` VALUES ('1275347999077244928', '', '');
INSERT INTO `sys_permission_point` VALUES ('1275348056220442624', '', '');
INSERT INTO `sys_permission_point` VALUES ('1277185714806616064', '', '');
COMMIT;

-- ----------------------------
-- Table structure for sys_role
-- ----------------------------
DROP TABLE IF EXISTS `sys_role`;
CREATE TABLE `sys_role` (
  `id` varchar(40) NOT NULL COMMENT '主键ID',
  `role_name` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '权限名称',
  `description` varchar(100) DEFAULT NULL COMMENT '说明',
  `state` tinyint(1) DEFAULT '1' COMMENT '启用状态 0是禁用，1是启用',
  `version` int NOT NULL COMMENT '版本锁标识',
  `create_name` varchar(40) NOT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `UK_k3beff7qglfn58qsf2yvbg41i` (`role_name`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='角色表';

-- ----------------------------
-- Records of sys_role
-- ----------------------------
BEGIN;
INSERT INTO `sys_role` VALUES ('1275297314998616064', '超级管理员', '拥有所有的权限', 1, 0, 'admin', '2020-06-23 13:19:08', '2020-06-23 13:19:08');
INSERT INTO `sys_role` VALUES ('1275674454759886848', '用户管理', '拥有用户所有的权限', 1, 0, 'admin', '2020-06-24 14:17:46', '2020-06-24 14:17:46');
COMMIT;

-- ----------------------------
-- Table structure for sys_role_permission
-- ----------------------------
DROP TABLE IF EXISTS `sys_role_permission`;
CREATE TABLE `sys_role_permission` (
  `role_id` varchar(40) NOT NULL COMMENT '角色ID',
  `permission_id` varchar(40) NOT NULL COMMENT '权限ID',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`role_id`,`permission_id`),
  KEY `FK74qx7rkbtq2wqms78gljv87a0` (`permission_id`),
  KEY `FKee9dk0vg99shvsytflym6egxd` (`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='角色权限表';

-- ----------------------------
-- Records of sys_role_permission
-- ----------------------------
BEGIN;
INSERT INTO `sys_role_permission` VALUES ('1275297314998616064', '1275298471313702912', '2020-06-29 16:32:23', '2020-06-29 16:32:23');
INSERT INTO `sys_role_permission` VALUES ('1275297314998616064', '1275298697055338496', '2020-06-29 16:32:23', '2020-06-29 16:32:23');
INSERT INTO `sys_role_permission` VALUES ('1275297314998616064', '1275299250242093056', '2020-06-29 16:32:23', '2020-06-29 16:32:23');
INSERT INTO `sys_role_permission` VALUES ('1275297314998616064', '1275299466001285120', '2020-06-29 16:32:23', '2020-06-29 16:32:23');
INSERT INTO `sys_role_permission` VALUES ('1275297314998616064', '1275299599447261184', '2020-06-29 16:32:23', '2020-06-29 16:32:23');
INSERT INTO `sys_role_permission` VALUES ('1275297314998616064', '1275337443121360896', '2020-06-29 16:32:23', '2020-06-29 16:32:23');
INSERT INTO `sys_role_permission` VALUES ('1275297314998616064', '1275346858469826560', '2020-06-29 16:32:23', '2020-06-29 16:32:23');
INSERT INTO `sys_role_permission` VALUES ('1275297314998616064', '1275346962291433472', '2020-06-29 16:32:23', '2020-06-29 16:32:23');
INSERT INTO `sys_role_permission` VALUES ('1275297314998616064', '1275347518758133760', '2020-06-29 16:32:23', '2020-06-29 16:32:23');
INSERT INTO `sys_role_permission` VALUES ('1275297314998616064', '1275347585481121792', '2020-06-29 16:32:23', '2020-06-29 16:32:23');
INSERT INTO `sys_role_permission` VALUES ('1275297314998616064', '1275347652111835136', '2020-06-29 16:32:23', '2020-06-29 16:32:23');
INSERT INTO `sys_role_permission` VALUES ('1275297314998616064', '1275347935546122240', '2020-06-29 16:32:23', '2020-06-29 16:32:23');
INSERT INTO `sys_role_permission` VALUES ('1275297314998616064', '1275347999077244928', '2020-06-29 16:32:23', '2020-06-29 16:32:23');
INSERT INTO `sys_role_permission` VALUES ('1275297314998616064', '1275348056220442624', '2020-06-29 16:32:23', '2020-06-29 16:32:23');
INSERT INTO `sys_role_permission` VALUES ('1275297314998616064', '1275663262871998464', '2020-06-29 16:32:23', '2020-06-29 16:32:23');
INSERT INTO `sys_role_permission` VALUES ('1275297314998616064', '1275664156741095424', '2020-06-29 16:32:23', '2020-06-29 16:32:23');
INSERT INTO `sys_role_permission` VALUES ('1275297314998616064', '1275664533494452224', '2020-06-29 16:32:23', '2020-06-29 16:32:23');
INSERT INTO `sys_role_permission` VALUES ('1275297314998616064', '1275665031249285120', '2020-06-29 16:32:23', '2020-06-29 16:32:23');
INSERT INTO `sys_role_permission` VALUES ('1275297314998616064', '1275665454454558720', '2020-06-29 16:32:23', '2020-06-29 16:32:23');
INSERT INTO `sys_role_permission` VALUES ('1275297314998616064', '1275665518673547264', '2020-06-29 16:32:23', '2020-06-29 16:32:23');
INSERT INTO `sys_role_permission` VALUES ('1275297314998616064', '1275665596758904832', '2020-06-29 16:32:23', '2020-06-29 16:32:23');
INSERT INTO `sys_role_permission` VALUES ('1275297314998616064', '1275665652522176512', '2020-06-29 16:32:23', '2020-06-29 16:32:23');
INSERT INTO `sys_role_permission` VALUES ('1275297314998616064', '1275665787255803904', '2020-06-29 16:32:23', '2020-06-29 16:32:23');
INSERT INTO `sys_role_permission` VALUES ('1275297314998616064', '1275665848387784704', '2020-06-29 16:32:23', '2020-06-29 16:32:23');
INSERT INTO `sys_role_permission` VALUES ('1275297314998616064', '1275665901982601216', '2020-06-29 16:32:23', '2020-06-29 16:32:23');
INSERT INTO `sys_role_permission` VALUES ('1275297314998616064', '1275665967027867648', '2020-06-29 16:32:23', '2020-06-29 16:32:23');
INSERT INTO `sys_role_permission` VALUES ('1275297314998616064', '1275675736404971520', '2020-06-29 16:32:23', '2020-06-29 16:32:23');
INSERT INTO `sys_role_permission` VALUES ('1275297314998616064', '1277185714806616064', '2020-06-29 16:32:23', '2020-06-29 16:32:23');
INSERT INTO `sys_role_permission` VALUES ('1275674454759886848', '1275298471313702912', '2020-06-29 17:35:35', '2020-06-29 17:35:35');
INSERT INTO `sys_role_permission` VALUES ('1275674454759886848', '1275298697055338496', '2020-06-29 17:35:35', '2020-06-29 17:35:35');
INSERT INTO `sys_role_permission` VALUES ('1275674454759886848', '1275299599447261184', '2020-06-29 17:35:35', '2020-06-29 17:35:35');
INSERT INTO `sys_role_permission` VALUES ('1275674454759886848', '1275337443121360896', '2020-06-29 17:35:35', '2020-06-29 17:35:35');
INSERT INTO `sys_role_permission` VALUES ('1275674454759886848', '1275346858469826560', '2020-06-29 17:35:35', '2020-06-29 17:35:35');
INSERT INTO `sys_role_permission` VALUES ('1275674454759886848', '1275346962291433472', '2020-06-29 17:35:35', '2020-06-29 17:35:35');
INSERT INTO `sys_role_permission` VALUES ('1275674454759886848', '1275664533494452224', '2020-06-29 17:35:35', '2020-06-29 17:35:35');
INSERT INTO `sys_role_permission` VALUES ('1275674454759886848', '1275665652522176512', '2020-06-29 17:35:35', '2020-06-29 17:35:35');
INSERT INTO `sys_role_permission` VALUES ('1275674454759886848', '1275665787255803904', '2020-06-29 17:35:35', '2020-06-29 17:35:35');
INSERT INTO `sys_role_permission` VALUES ('1275674454759886848', '1275665848387784704', '2020-06-29 17:35:35', '2020-06-29 17:35:35');
INSERT INTO `sys_role_permission` VALUES ('1275674454759886848', '1275665901982601216', '2020-06-29 17:35:35', '2020-06-29 17:35:35');
INSERT INTO `sys_role_permission` VALUES ('1275674454759886848', '1275665967027867648', '2020-06-29 17:35:35', '2020-06-29 17:35:35');
INSERT INTO `sys_role_permission` VALUES ('1275674454759886848', '1275675736404971520', '2020-06-29 17:35:35', '2020-06-29 17:35:35');
INSERT INTO `sys_role_permission` VALUES ('1275674454759886848', '1277185714806616064', '2020-06-29 17:35:35', '2020-06-29 17:35:35');
COMMIT;

-- ----------------------------
-- Table structure for sys_user
-- ----------------------------
DROP TABLE IF EXISTS `sys_user`;
CREATE TABLE `sys_user` (
  `id` varchar(40) NOT NULL COMMENT 'ID',
  `mobile` varchar(11) NOT NULL COMMENT '手机号码',
  `username` varchar(40) NOT NULL COMMENT '用户名称',
  `password` varchar(255) DEFAULT NULL COMMENT '密码',
  `state` tinyint(1) DEFAULT '1' COMMENT '启用状态 0是禁用，1是启用',
  `version` int NOT NULL COMMENT '版本锁标识',
  `create_name` varchar(40) NOT NULL COMMENT '创建人',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `UK_user_phone` (`mobile`) USING BTREE,
  UNIQUE KEY `UK_username_index` (`username`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户表';

-- ----------------------------
-- Records of sys_user
-- ----------------------------
BEGIN;
INSERT INTO `sys_user` VALUES ('1275296895530467328', '18888888888', 'admin', '4ae73da756691484c77397749204e9ed', 1, 1, 'admin', '2020-06-23 13:17:28', '2020-06-28 07:45:54');
INSERT INTO `sys_user` VALUES ('1277520411671724032', '17621959589', 'hulei', 'a3c161e1b853f7d75e95184a600c3438', 1, 0, 'admin', '2020-06-29 16:32:56', '2020-06-29 16:32:56');
COMMIT;

-- ----------------------------
-- Table structure for sys_user_role
-- ----------------------------
DROP TABLE IF EXISTS `sys_user_role`;
CREATE TABLE `sys_user_role` (
  `role_id` varchar(40) NOT NULL COMMENT '角色ID',
  `user_id` varchar(40) NOT NULL COMMENT '权限ID',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`role_id`,`user_id`),
  KEY `FK74qx7rkbtq2wqms78gljv87a1` (`role_id`),
  KEY `FKee9dk0vg99shvsytflym6egx1` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户角色表';

-- ----------------------------
-- Records of sys_user_role
-- ----------------------------
BEGIN;
INSERT INTO `sys_user_role` VALUES ('1275297314998616064', '1275296895530467328', '2020-06-29 16:41:51', '2020-06-29 16:41:51');
INSERT INTO `sys_user_role` VALUES ('1275674454759886848', '1277520411671724032', '2020-06-29 17:01:44', '2020-06-29 17:01:44');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;


# 查询用户菜单
SELECT s.id,
       s.name,
       s.description,
       s.type,
       s.pid,
       s.code,
       m.menu_url,
       m.menu_icon,
       m.menu_order,
       p.point_class,
       p.point_icon,
       a.api_url,
       a.api_method,
       a.api_level,
       s.version,
       s.create_name,
       s.create_time,
       s.update_time
FROM sys_permission s
         LEFT JOIN sys_role_permission rp ON s.id = rp.permission_id
         LEFT JOIN sys_role r ON r.id = rp.role_id
         LEFT JOIN sys_user_role ur ON ur.role_id = rp.role_id
         LEFT JOIN sys_user u ON u.id = ur.user_id
         LEFT JOIN sys_permission_menu m ON s.id = m.id
         LEFT JOIN sys_permission_point p ON s.id = p.id
         LEFT JOIN sys_permission_api a ON a.id = m.id
where u.id = '1275296895530467328'
order by m.menu_order asc;

